﻿using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;

public class GameMangagers : MonoBehaviour
{

	GameObject TPanel;
	public int CourseID;
	GameObject UIRoot;
	//string url;
	void Start()
	{
		UIRoot = GameObject.Find("UIRoot");

		//url = "http://172.16.40.67:8000/";
		//var filePath1 = Application.persistentDataPath + "";
	}
	public void CreatPanel(string namePanel, string CourseID)
	{

		TPanel = Resources.Load<GameObject>(namePanel.ToString());
		if (TPanel != null)
		{
			GameObject go = Instantiate(TPanel, UIRoot.transform);
			go.name = (namePanel.ToString());
			var texture = Resources.Load<Sprite>(CourseID);
			if (texture != null)
			{
				go.gameObject.GetComponent<Image>().sprite = texture;
			}
			else
			{

			}

		}
		else
		{
			Debug.Log("没有发现该界面");
		}

	}




	void Update()
	{

	}






	public IEnumerator LoadCourse(string Id)
	{
		yield return null;
		//while (gameMangagers.spr == null)
		//{
		//	yield return null;
		//}
		//gameMangagers.CreatPanel("CoursePanel");
		//GameObject.Find("CoursePanel").GetComponent<CourseManager>().Init();
		//GameObject.Find("CoursePanel").GetComponent<CourseView>().TittleText.text = AccountModel.Instances.count[int.Parse(Id) - 1];

		//this.gameObject.SetActive(false);
	}
}




